<?php get_header(); ?>

     <div id="page">
          <div id="content">
				
  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
	
		<div class="post">
<div class="date"><?php the_time('F j, Y') ?></div>                                
				<h1 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
				<p class="postinfo">In <?php the_category(', ') ?> | <a href="<?php comments_link(); ?>"><?php comments_number('no comments yet','1 comment','% comments'); ?></a> | <a href="<?php the_permalink() ?>">permalink</a></p>
				<div class="author">Written by<br /><?php the_author() ?></div>
				<div class="entry">
					<?php the_content('Read the rest of this entry &raquo;'); ?>
				</div>

                                       	<p class="postinfo2"><a href="mailto:?Subject=Check This Out&amp;body=I think you'll like this: <?php echo the_permalink(); ?>">email this</a>&nbsp;|&nbsp;<a href="http://del.icio.us/post?url=<?php the_permalink() ?>&amp;title=<?php bloginfo('name'); ?>:<?php the_title(); ?>">tag this</a>&nbsp;|&nbsp;<a href="http://www.digg.com/submit" target="_new">digg this</a>&nbsp;|&nbsp;<a href="<?php trackback_url() ?>">trackback</a>&nbsp;|&nbsp;<?php comments_rss_link('comment RSS feed'); ?></p>

</div>
	<p style="padding:8px 0 8px;border-top:solid 1px #ccc;border-bottom:solid 1px #ccc" align="center">
<script type="text/javascript"><!--
google_ad_client = "<?php google_pub_id()?>";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "FF0000";
google_color_text = "000000";
google_color_url = "999999";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</p>

	<?php comments_template(); ?>

	
	<?php endwhile; else: ?>
	
          <h1 class="pagetitle">Oops. Sorry. 404 Not Found</h1>
          <p class="archivepost">Hmmm ... Not sure what happened to this page. The slaves, err employees must have screwed something up. Please be patient. When we discover the culprit he or she will be thoroughly questioned, then flogged, then fired. In the meantime, just click the "Home" button above.</p> 
	
<?php endif; ?>
<?php
$this_post = $post;
$category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;
$posts = get_posts('numberposts=6&offset=0&orderby=post_date&order=DESC&category='.$category);
$count = 0;
foreach ( $posts as $post ) {
if ( $post->ID == $this_post->ID || $count == 5) {
unset($posts[$count]);
}else{
$count ++;
}
}
?>
<?php if ( $posts ) : ?>
<div class="post">
<h3>Related articles</h3>
<ul>
<?php foreach ( $posts as $post ) : ?>
<li><a href="<?php the_permalink() ?>" title="<?php echo trim(str_replace("\n"," ",preg_replace('#<[^>]*?>#si','',get_the_excerpt()))) ?>"><?php if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; } ?></a> (<?php the_time('F jS, Y') ?>)</li>
<?php endforeach // $posts as $post ?>
</ul>
</div>
<?php endif // $posts ?>

			

			</div>

<?php get_sidebar(); ?>

     </div>


<?php get_footer(); ?>
